<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Tutorial: Hello Dojo!</title>
	<link rel="stylesheet" href="css/helloDojo.css">
</head>
<body>
	<h1 id="greeting">Hello</h1>
	<!-- load dojo and provide config via data attribute -->
		<script src="js/dojo/dojo.js" data-dojo-config="isDebug:1, async:1"></script>
	<script>
		// `foo` is intentionally global
		var foo = "bar";
		require(["dojo/_base/lang"],
			function(lang) {
		 
				var myFunction = function(){
					return this.foo;
				};
				var myObject = { foo: "baz" };
		 
				// later on in your application
				var boundFunction = lang.hitch(myObject, myFunction);
		 
				// the first value will be "bar", the second will be "baz";
				// the third will still be "bar".
				console.log(myFunction());       // "bar"
				console.log(boundFunction());    // "baz"
				console.log(myFunction());       // "bar"
				console.log('----------------------------------');     
				
				
				var foo = { d: "fooA" , bar: function(a, b, c){ console.log(a, b, c, this.d); } };
				var foo2 = {d : "fooB" } ;
				var fn = lang.hitch(foo, "bar", 1, 2);
				fn(3); // logs "1, 2, 3"
				var foo2 = {d : "fooB" } ;
				var fn2 = lang.hitch(foo2, foo.bar, 1, 3);
				fn2(5);
				console.log('----------------------------------'); 
				
				
				function log(a, b, c, d)
				{
					console.log(a, b, c, d);
				}
				
				var logfn = lang.partial(log, 1, 2 ,3);
				logfn(4);
				
				var logfn2 = lang.partial(log, 7, 8);
				logfn2(3, 4);
		});
	</script>
</body>
</html>